﻿package mortal.game.view.lookPlayerInfo.view
{
    import Message.DB.Tables.*;
    import Message.Game.*;
    import __AS3__.vec.*;
    import com.mui.controls.*;
    import com.mui.utils.*;
    import extend.language.*;
    import mortal.common.*;
    import mortal.common.global.*;
    import mortal.game.resource.*;
    import mortal.game.resource.tableConfig.*;
    import mortal.game.utils.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.display.*;
    import mortal.game.view.lookPlayerInfo.*;

    public class LookSystemRightPart extends GSprite
    {
        private var _tmountInfo:TMountConfig;
        private var _bg:GImageBitmap;
        private var _name:GTextFiled;
        private var _level:GImageBitmap;
        private var _expBar:BaseProgressBar;
        private var _levelTxt:GTextFiled;
        private var _levelUpTxt:GTextFiled;
        private var _expTips:GTextFiled;
        private var _comBat:BitmapNumberText;
        private var _vcAttributeName2:Vector.<String>;
        private var _vcAttributeValueText:Vector.<BitmapNumberText>;
        protected var _slookplayerInfo:SLookPlayerInfo;
        protected var _slookPlayerMountInfo:SLookPlayerMountInfo;
        protected var _lookType:int;

        public function LookSystemRightPart()
        {
            this._vcAttributeName2 = new Vector.<String>;
            this._vcAttributeValueText = new Vector.<BitmapNumberText>;
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            var _loc_3:GTextFiled = null;
            var _loc_4:BitmapNumberText = null;
            var _loc_5:GBitmap = null;
            super.createDisposedChildrenImpl();
            this._name = UIFactory.gTextField("", 129, 3, 141, 35, this, GlobalStyle.textFormatPutong.setColor(16777215).setSize(16).setBold(true));
            this._level = UIFactory.gImageBitmap("", 64, 2, this);
            this._comBat = UIFactory.bitmapNumberText(127, 70, "WizardCombatNum.png", 23, 30, -3, this, 13, BitmapNumberText.Mid);
            this._levelTxt = UIFactory.gTextField("", 0, 0, 100, 20, this);
            this._expTips = UIFactory.gTextField(Language.getString(30321), 58, 416, 150, 20, null, null, true);
            var _loc_1:* = GlobalStyle.textFormatAnHuan.center();
            _loc_1.size = 14;
            _loc_1.bold = true;
            this._levelUpTxt = UIFactory.gTextField("", 29, 358, 200, 30, this, _loc_1);
            this._expBar = UICompomentPool.getUICompoment(BaseProgressBar);
            this._expBar.x = 8;
            this._expBar.y = 395;
            this._expBar.setBg(ImagesConst.MountBarBg, true, 246, 13);
            this._expBar.setProgress(ImagesConst.MountBar, true, 4, 4, 238, 13);
            this._expBar.setLabel(BaseProgressBar.ProgressBarTextOnlyShowValue, 23);
            this._expBar.isOverShowValue = true;
            this._expBar.mouseChildren = false;
            this._expBar.mouseEnabled = true;
            this.addChild(this._expBar);
            _loc_1 = GlobalStyle.textFormatAnHuan;
            _loc_1.size = 12;
            this._vcAttributeName2.length = 0;
            this._vcAttributeValueText.length = 0;
            var _loc_2:* = MountConfig.instance.attribute;
            var _loc_6:int = 0;
            while (_loc_6 < _loc_2.length)
            {
                
                _loc_4 = UIFactory.bitmapNumberText(50 + _loc_6 % 2 * 134, 12 * (_loc_6 - _loc_6 % 2) + 164, "RoleInfoNum.png", 8, 10, -1, this, 14);
                this._vcAttributeValueText.push(_loc_4);
                pushUIToDisposeVec(_loc_4);
                _loc_6++;
            }
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._levelUpTxt.dispose(param1);
            this._levelUpTxt = null;
            this._expTips.dispose(param1);
            this._expTips = null;
            this._levelTxt.dispose(param1);
            this._levelTxt = null;
            this._name.dispose(param1);
            this._name = null;
            this._level.dispose(param1);
            this._level = null;
            this._comBat.dispose(param1);
            this._comBat = null;
            this._expBar.dispose(param1);
            this._expBar = null;
            if (this._bg)
            {
                this._bg.dispose(param1);
                this._bg = null;
            }
            this._tmountInfo = null;
            this._vcAttributeName2.length = 0;
            this._vcAttributeValueText.length = 0;
            this._slookplayerInfo = null;
            this._slookPlayerMountInfo = null;
            super.disposeImpl(param1);
            return;
        }// end function

        protected function addBg() : void
        {
            var _loc_1:* = LookPlayerUtil.getRightBgUrlByLookType(this._lookType);
            this._bg = UIFactory.gImageBitmap(_loc_1, 0, 0, this);
            this.addChildAt(this._bg, 0);
            return;
        }// end function

        protected function updateAttrData() : void
        {
            var _loc_3:int = 0;
            var _loc_1:* = MountConfig.instance.attribute;
            var _loc_2:* = _loc_1.length;
            var _loc_4:int = 0;
            while (_loc_4 < _loc_2)
            {
                
                this._vcAttributeValueText[_loc_4].text = MountUtil.getAttrValueByName(_loc_1[_loc_4], this._slookPlayerMountInfo.code, LookPlayerUtil.getConfigTypeByLookType(this._lookType), this._slookPlayerMountInfo.skillIds, this._slookPlayerMountInfo.playerItems, this._slookPlayerMountInfo.growth, this._slookPlayerMountInfo.talent, this._slookplayerInfo.miniPlayer.VIP, LookPlayerUtil.getVipRecordTypeByLookType(this._lookType).type) + "";
                _loc_4++;
            }
            return;
        }// end function

        public function setLookInfo(param1:SLookPlayerInfo, param2:SLookPlayerMountInfo, param3:int) : void
        {
            this._slookplayerInfo = param1;
            this._slookPlayerMountInfo = param2;
            this._lookType = param3;
            this._tmountInfo = MountConfig.instance.getMountInfoByCode(this._slookPlayerMountInfo.code, LookPlayerUtil.getConfigTypeByLookType(this._lookType));
            this._level.imgUrl = "levelIcon_" + this._slookPlayerMountInfo.code + ".png";
            this._name.text = this._tmountInfo.name;
            this._comBat.text = "" + MountUtil.getMountCombat(this._slookPlayerMountInfo.code, LookPlayerUtil.getConfigTypeByLookType(this._lookType), this._slookPlayerMountInfo.skillIds, this._slookPlayerMountInfo.playerItems, this._slookPlayerMountInfo.growth, this._slookPlayerMountInfo.talent, this._slookplayerInfo.miniPlayer.VIP, LookPlayerUtil.getVipRecordTypeByLookType(this._lookType).type);
            if (this._slookPlayerMountInfo.code == 10)
            {
                this._levelUpTxt.text = Language.getString(35340);
                this._expBar.setValue(0, 100);
            }
            else
            {
                this._levelUpTxt.text = "";
                this._expBar.setValue(this._slookPlayerMountInfo.wish, this._tmountInfo.blessMax);
            }
            this.updateAttrData();
            this.addBg();
            return;
        }// end function

        public function get expBar() : BaseProgressBar
        {
            return this._expBar;
        }// end function

    }
}
